/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.storebits.testsystem;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Ventsi
 */
@Entity
@Table(name = "hotelreservation")
@NamedQueries({
    @NamedQuery(name = "Hotelreservation.findAll", query = "SELECT h FROM Hotelreservation h")})
public class Hotelreservation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idHotelReservation")
    private Integer idHotelReservation = new Integer(0);
    @Basic(optional = false)
    @NotNull
    @Column(name = "numberOfPeople")
    private int numberOfPeople;
    @Column(name = "room")
    private List<Integer> rooms;
    @JoinColumn(name = "hotel", referencedColumnName = "idHotel")
    @ManyToOne
    private Hotel hotel;
    @JoinColumn(name = "customer", referencedColumnName = "USERNAME")
    @OneToOne(optional = false)
    private Users customer;
    @NotNull
    @Column(name = "startDate")
    @Temporal(TemporalType.DATE)
    private Date startDate;
    @NotNull
    @Column(name = "endDate")
    @Temporal(TemporalType.DATE)
    private Date endDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "deposit")
    private BigDecimal deposit = new BigDecimal(0);
    @Basic(optional = false)
    @NotNull
    @Column(name = "totalSum")
    private BigDecimal totalSum = new BigDecimal(0);

    public Hotelreservation() {
    }

    public Hotelreservation(Integer idHotelReservation) {
        this.idHotelReservation = idHotelReservation;
    }

    public Hotelreservation(Integer idHotelReservation, int numberOfPeople) {
        this.idHotelReservation = idHotelReservation;
        this.numberOfPeople = numberOfPeople;
    }

    public Integer getIdHotelReservation() {
        return idHotelReservation;
    }

    public void setIdHotelReservation(Integer idHotelReservation) {
        this.idHotelReservation = idHotelReservation;
    }

    public int getNumberOfPeople() {
        return numberOfPeople;
    }

    public void setNumberOfPeople(int numberOfPeople) {
        this.numberOfPeople = numberOfPeople;
    }

    public List<Integer> getRooms() {
        return rooms;
    }

    public void setRooms(List<Integer> rooms) {
        System.out.println("setRooms(" + rooms + ")");
        this.rooms = rooms;
    }

    

    public Hotel getHotel() {
        return hotel;
    }

    public void setHotel(Hotel hotel) {
        this.hotel = hotel;
    }

    public Users getCustomer() {
        return customer;
    }

    public void setCustomer(Users customer) {
        this.customer = customer;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public void setDeposit(BigDecimal deposit) {
        this.deposit = deposit;
    }

    public BigDecimal getDeposit() {
        return deposit;
    }

    public BigDecimal getTotalSum() {
        return totalSum;
    }

    public void setTotalSum(BigDecimal totalSum) {
        this.totalSum = totalSum;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHotelReservation != null ? idHotelReservation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hotelreservation)) {
            return false;
        }
        Hotelreservation other = (Hotelreservation) object;
        if ((this.idHotelReservation == null && other.idHotelReservation != null) || (this.idHotelReservation != null && !this.idHotelReservation.equals(other.idHotelReservation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.storebits.testsystem.Hotelreservation[ idHotelReservation=" + idHotelReservation + " ]";
    }
    
}
